//
//  ZH_MineInvitationViewController.m
//  WisdomStar
//
//  Created by zhangliwen on 2018/10/24.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "ZH_MineInvitationViewController.h"
#import "ZH_MineViewModel.h"
@interface ZH_MineInvitationViewController ()
@property (nonatomic,weak)UIImageView *bgView;
@property (nonatomic,weak)UILabel *titleLabel;
@property (nonatomic,weak)UIImageView *bgViews;
@property (nonatomic,weak)UILabel *contentLabel;
@property (nonatomic,weak)UILabel *detailLabel;
@property (nonatomic,weak)UIButton *button;
@property (nonatomic,strong)ZH_MineViewModel *viewModel;
@end

@implementation ZH_MineInvitationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initUserInterface];
}
- (void)cleanUpData{
    [self setViewModel:nil];
}
- (void)initUserInterface{
    self.navigationItem.title = @"邀请有奖";
    self.view.backgroundColor = kFontColorWhite;
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(FITSCALE(31));
//        make.centerX.equalTo(self.view);
        make.left.equalTo(self.view).offset(FITSCALE(37));
        make.right.equalTo(self.view).offset(FITSCALE(-37));
        make.height.mas_equalTo(FITSCALE(402));
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.bgView).offset(FITSCALE(21));
        make.centerX.equalTo(self.view);
    }];
    [self.bgViews mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.mas_bottom).offset(FITSCALE(20));
        make.centerX.equalTo(self.view);
    }];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.bgViews.mas_bottom).offset(FITSCALE(13));
        make.left.equalTo(self.bgView).offset(FITSCALE(21));
        make.right.equalTo(self.bgView).offset(FITSCALE(-32));
        make.bottom.equalTo(self.bgView).offset(FITSCALE(-41));
    }];
    [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.bgView.mas_bottom).offset(FITSCALE(35));
        make.centerX.equalTo(self.view);
    }];
    [self.button mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.detailLabel.mas_bottom).offset(FITSCALE(29));
        make.left.equalTo(self.view).offset(FITSCALE(22));
        make.right.equalTo(self.view).offset(FITSCALE(-22));
        make.height.mas_equalTo(FITSCALE(46));
    }];
}

#pragma mark - getter,setter
- (UIImageView *)bgView{
    if (!_bgView) {
        UIImageView *image = [UIImageView createImageViewWithName:@"img_ewm_bg"];
        [self.view addSubview:_bgView = image];
    }
    return _bgView;
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        UILabel *label = [UILabel createLabelWithText:@"扫一扫" font:kFontSize_36];
        label.textColor = [UIColor colorWithHexString:@"#00C9AE"];
        [self.view addSubview:_titleLabel = label];
    }
    return _titleLabel;
}
- (UIImageView *)bgViews{
    if (!_bgViews) {
        UIImageView *image = [UIImageView createImageViewWithName:@"img_ewm_plat"];
        [self.view addSubview:_bgViews= image];
    }
    return _bgViews;
}
- (UILabel *)contentLabel{
    if (!_contentLabel) {
        UILabel *label = [UILabel createLabelWithText:@"邀请有奖文字介绍, 邀请有奖文字介绍, 邀请有奖文字介绍, 邀请有奖文字介绍, 邀请有奖文字介绍, 邀请有奖文字介绍, 邀请有奖文字介绍, 邀请有奖文字介绍, 邀请有奖文字介绍, 邀请有奖文字介绍, 邀请有奖文字介绍..." font:kFontSize_28];
        [label lableAutoLinefeed];
        [self.view addSubview:_contentLabel = label];
    }
    return _contentLabel;
}
- (UILabel *)detailLabel{
    if (!_detailLabel) {
        UILabel *label = [UILabel createLabelWithText:@"我的推荐码: 56HJKL" font:kFontSize_30];
        label.font = [UIFont boldSystemFontOfSize:15.0];
        [self.view addSubview:_detailLabel = label];
    }
    return _detailLabel;
}
- (UIButton *)button{
    if (!_button) {
        UIButton *button = [UIButton createNoBgButtonWithTitle:@"复制" target:self action:nil];
        button.backgroundColor = [UIColor colorWithHexString:@"#00C9AE"] ;
        [button setTitleColor:kFontColorWhite forState:UIControlStateNormal];
        button.layer.cornerRadius = FITSCALE(22);
        button.layer.masksToBounds = YES;
        button.clipsToBounds = YES;
        button.titleLabel.font = kFontSize_34;
        [self.view addSubview:_button = button];
    }
    return _button;
}
- (ZH_MineViewModel *)viewModel{
    if (!_viewModel) {
        _viewModel = [[ZH_MineViewModel alloc] init];
    }
    return _viewModel;
}
@end
